package me.cat.innerclass.a02innerclassdemo2;

public class Test {
    public static void main(String[] args) {
        //编写匿名内部类代码
        new Swim() {
            @Override
            public void swim() {
                System.out.println("重写了游泳的方法");
            }
        };
        new Animal() {
            @Override
            public void eat() {
                System.out.println("重写了eat方法");
            }
        };

        method(
                new Animal() {
                    @Override
                    public void eat() {
                        System.out.println("重写了eat方法");
                    }
                }
        );

    }

    public static void method(Animal a) {
        a.eat();
    }
}
